package day6;

import java.util.Arrays;

/**
 * @Author juzipi
 * @Date 2021/6/9 20:19
 * @Info
 */

public class TwoListPractice {
    

    public static void main(String[] args) {
        int[][] arr = new int[][]{{1,2,3},{3,4,5,6},{2,3,4,5}};

        int sum = 0;
        for (int i = 0; i < arr.length; i++) {
            for (int j = 0; j < arr[i].length; j++) {
                sum += arr[i][j];
            }
        }
        System.out.println(sum);

        int[][] yanghui = new int[10][];
        for (int i = 0; i < yanghui.length; i++) {
            yanghui[i] = new int[i+1];
            //给首末元素赋值
            yanghui[i][0] = yanghui[i][i] = 1;
            //给每行非首末元素赋值
//            if (i >1){
                for (int j = 1; j < i; j++) {
                    yanghui[i][j] = yanghui[i-1][j-1] + yanghui[i-1][j];
                }
//            }

        }
        for (int[] ints : yanghui) {
            for (int anInt : ints) {
                System.out.print(anInt + " ");
            }
            System.out.println();
        }

    }
}
